package org.jeecgframework.web.material.controller;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.web.material.service.HomeServiceI;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;



/**   
 * @Description: 首页数据统计
 * @date 2015-08-17 10:01:47
 * @version V1.0   
 *
 */
@Scope("prototype")
@Controller
@RequestMapping("/homeController")
public class HomeController extends BaseController {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(HomeController.class);

	@Autowired
	private HomeServiceI homeService;
	@Autowired
	private SystemService systemService;
	private String message;
	
	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	
	
	/**
	 * 统计
	 * 
	 * @param ids
	 * @return
	 */
	@RequestMapping(params = "statisticSum")
	@ResponseBody
	public AjaxJson statisticSum(HttpServletRequest request) {
		AjaxJson j = new AjaxJson();
		message = "成功";
		try{
			Map map = homeService.statisticSum();
			j.setObj(map);
		}catch(Exception e){
			e.printStackTrace();
			message = "失败";
			j.setSuccess(false);
			throw new BusinessException(e.getMessage());
		}
		j.setMsg(message);
		return j;
	}

}
